<script type="text/javascript">
  function PrintDiv() {    
           var divToPrint = document.getElementById('print');
           var popupWin = window.open('', '_blank', 'width=800,height=800');
           popupWin.document.open();
           popupWin.document.write('<html><body onload="window.print()">' + divToPrint.innerHTML + '</html>');
            popupWin.document.close();
                }
</script>
<div align="right">
<input type="button" value="Print" onclick="PrintDiv();"></div>
<div class="row-fluid" id="print">
<p align="center"><h3 align="center">
<?php if($sales['invoice_type']=='Retail'){
	echo "CANCEL RETAIL REPORT";
	 }else{
	 echo 	"CANCEL TAX REPORT";
	} ?></h3></p>
<div class="span1">&nbsp;&nbsp; </div>
<div class="span10">
<div class="row-fluid"> 
<div class="span12">
<table border="1px" width="100%">
		<tr>
            <td><?php  echo "<strong>".$profile['name']."</strong><br>";
	echo $profile['address']."<br>";
	echo $profile['email']."<br>";
	echo $profile['phone_no']."<br>"; ?></td>
		<td>
		<table border="1px" width="100%">
		<tr>
            <td>Invoice No<br><?php echo '<strong>'.$sales['invoice_no'].'</strong>'; ?></td>
			<td>Dated<br><?php echo '<strong>'.$sales['date'].'</strong>'; ?></td>
		</tr>
		<?php if($sales['invoice_type']!='Retail'){?>
		<tr>
            <td>Company's Tin No<br><?php echo '<strong>'.$profile['tin_no'].'</strong>'; ?></td>
			<td>Buyers's Tin No<br><?php echo '<strong>'.$customer['tin_no'].'</strong>'; ?></td>
		</tr>
		<?php }?>

		
		</table>
		</td>
		</tr>
		<tr>
		
            <td><h4><b>Buyer Details</h4><?php echo $customer['first_name']."</b><br>";
	echo $customer['address']."<br>";
	echo $customer['email']."<br>";
	echo $customer['phone']."<br>";
	 ?></td>
				<td>
		<table border="1px" width="100%">
		<tr>
            <td>Cancelled By<br><?php echo '<strong>'.$sales['cancel_by'].'</strong>'; ?></td>
		</tr>
		

		
		</table>
		</td>

		</tr>

</table>
</div>
</div>
<br>
<div class="row-fluid">
<div class="span12" >
<table border="1px" width="100%">
	<thead>
    <tr>
		<th>Product Name</th>
		<th>Quantity</th>
    	<th>Toatal Price</th>	
	</tr>
    </thead>
	<?php foreach ($products as $product):?>
		<tr>
			<td><?php  echo $this->purchase_model->get_product_details($product->id_product); ?></td>
			<td><table border="1px">
			<tr>
				<td>Previous Quantity</td>
				<Td>Cancel/Return Quantity</td>
				<td>New Billed Quantity</td>
			</tr>
			<tr>
				<th><?= $product->previous_quantity?></th>
				<th><?= $product->cancel_quantity?></th>
				<th><?= $product->new_quantity?></th>	
			</tr>
			</table></td>
        	<td>
				<table border="1px">
			<tr>
				<td>Previous Price</td>
				<td>Cancel/Return price</td>
				<td>New Billed Price</td>
			</tr>
			<tr>
				<th><?= $product->previous_total?></th>
				<th><?= $product->cancel_total?></th>
				<th><?= $product->new_total?></th>	
			</tr>
			</table>
			</td>
		</tr>
	<?php endforeach;?>
</table>
</div>
</div>
<hr>
<div class="row-fluid">
<div class="span4">&nbsp;&nbsp;&nbsp;</div>
<div class="span4">
<table  border="1px" width="100%">
			<tr>
			<td><b>Total Price</b></td><td>
			<table border="1px">
			<tr><td>Previous Total Price<td><th><?php  echo $sales['previous_total']; ?></th></tr>
			<tr><td>Cancel Total Price<td><th><?php  echo $sales['cancel_total']; ?></th></tr>
			<tr><td>New Total Price<td><th><?php  echo $sales['new_total']; ?></th></tr>
			</table>
			</td>
			</tr>
			

</table>
<div class="span4">&nbsp;&nbsp;&nbsp;</div>

 </div>
 
</div>
<div class="row-fluid">
<div class="span12">
<table>
<tr>
<td width="60%"><b>Declarion:</b><br>We declare that this invoice shows the actual price of the goods described and that all particulars are true and correct</td>
<td><p align="right"><b>For <?php echo  $profile['name'];?></b></p><br>
<br>
</td>

</tr>
</table>
</div>
</div>

</div>
<div class="span1">&nbsp;&nbsp; </div>
</div>